How Do I Select a `td` Element in a Row That Has a Checkbox That is Checked?

Posted by Russ Bradberry on Stack Overflow See other posts from Stack Overflow or by Russ Bradberry
Published on 2010-06-17T21:33:29Z Indexed on 2010/06/17 21:43 UTC
Read the original article Hit count: 220

Filed under:
|

I have a table that looks somethings like this:

<table>
  <tr class="row even">
    <td><input type="checkbox" /></td>
    <td class="name">foo</td>
    <td class="metric">22</td>
  </tr>

  ...etc

What I want to do is get an array of all td.metric only in rows that have the checkbox checked. This didn't work out as expected:

var ticks = $.map($("tr td input:checked td.metric"), function(v,i){ return ... }); 

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery